﻿// *****************************************************************************
// **                   Ladenius MediaCenter TVSeries                         **
// ** ----------------------------------------------------------------------- **
// ** (c) 2008 by Jurjen Ladenius                                             **
// *****************************************************************************

#region Using directives
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Ladenius.TheTVDB.Entities;
using Ladenius.TheTVDB.Dao;
#endregion

namespace Ladenius.TheTVDB.Business {
    /// <summary>
    /// Provides business logic for languages
    /// </summary>
    internal static class LanguageHome {

        #region Fields
        private static List<Language> _languages = null;
        #endregion

        #region Public methods
        /// <summary>
        /// Gets the languages.
        /// </summary>
        /// <returns>a list of languages</returns>
        internal static List<Language> GetAll() {
            if (_languages == null) _languages = XMLRequester.GetLanguages();
            return _languages;
        }
        internal static Language GetByAbbreviation(string abbreviation) {
            return GetAll().Where<Language>(d => d.Abbreviation == abbreviation).SingleOrDefault<Language>();
        }
        #endregion

        #region Private methods
        #endregion
    }
}
